﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class LibrarianView : BasePage
{
    void Page_PreInit(object sender, System.EventArgs e)
    {
        String theme = (String)Session["theme"];
        if (theme == null)//if session timed out
        {
            ManageLibrary manager = new ManageLibrary();
            Library lib = manager.getLibrary(Request.QueryString["id"]);
            if (lib == null)//if library not found
                lib.Theme = "Blue";
            Session["theme"] = lib.Theme;
            theme = lib.Theme;
        }
        Page.Theme = theme.Trim();
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ddSelectMode_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddSelectMode.Text == "Browse")
                WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
            else if (ddSelectMode.Text == "Design")
                WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
            else if (ddSelectMode.Text == "Catalog")
                WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
        }
        catch (Exception ex)
        {

        }
    }
    protected void lbReset_Click(object sender, EventArgs e)
    {
        try
        {
            PersonalizationAdministration.ResetAllState(PersonalizationScope.User);
            int libid = int.Parse(Request.QueryString["id"]);
            Response.Redirect("LibrarianView.aspx?id=" + libid);
        }
        catch (Exception ex)
        {

        }
    }
}
